export default {
  props: {
    value: String,
    options: Object
  },
  render(h) {
    var options = Object.assign(
      {
        fit: 'contain',
        defaultImage: '',
        ratio: 0,
        defaultText: '暂无图片'
      },
      this.options
    )
    const { fit, defaultImage, defaultText, ratio } = options
    return h('em-image', {
      attrs: {
        src: this.value || defaultImage,
        fit: fit,
        ratio: ratio
      },
      scopedSlots: {
        error: () => {
          return h(
            'span',
            {
              attrs: {
                class: 'error'
              }
            },
            defaultText
          )
        }
      }
    })
  }
}
